package com.pan.entity;


import com.pan.vo.UserRegisterVo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.sql.Timestamp;


@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class User{
    Long id;
    Long tel;
    String email;
    String gender;
    Timestamp birthday;
    String name;
    String img;
    Integer districtId;
    String job;
    String sign;
    Long score;
    Long growth;
    Integer userStatus;
    String password;
    String salt;
    Timestamp registerDate;
    Timestamp lastLoginDate;
    Long loginCount;

    public User(UserRegisterVo userRegisterVo,String password,String salt){
        tel = userRegisterVo.getTel();
        email = userRegisterVo.getEmail();
        gender = userRegisterVo.getGender();
        name = userRegisterVo.getName();
        img = userRegisterVo.getImg();
        districtId = userRegisterVo.getDistrictId();

        this.password = password;
        this.salt = salt;

        score = 0L;
        growth = 0L;

        userStatus = 0;
        registerDate = new Timestamp(System.currentTimeMillis());
        lastLoginDate = new Timestamp(System.currentTimeMillis());

        loginCount = 0L;
    }
}